﻿using Blazorise;
using Microsoft.AspNetCore.Components;
using System.Threading.Tasks;
using Volo.Abp.AspNetCore.Components.Alerts;
using Volo.Abp.AspNetCore.Components.Messages;
using Volo.Abp.AspNetCore.Components.Progression;

namespace AntDesign.DemoApp.Blazor.Pages;

public partial class Index
{
    [Inject]
    public ConfirmService ConfirmService { get; set; }

    [Inject]
    public ModalService ModalService { get; set; }

    private readonly IUiMessageService _uiMessageService;
    private readonly IAlertManager _alertManager;
    private readonly IUiPageProgressService _pageProgressService;

    public Index(IUiMessageService uiMessageService, IAlertManager alertManager, IUiPageProgressService pageProgressService)
    {
        _uiMessageService = uiMessageService;
        _alertManager=alertManager;
        _pageProgressService=pageProgressService;
    }

    public async Task SendMessage()
    {
         await _uiMessageService.Success(
            "Your changes have been successfully saved!",
            "Congratulations");
    }
    public void SendAlert()
    {
        _alertManager.Alerts.Warning(
                "We will have a service interruption between 02:00 AM and 04:00 AM at October 23, 2023!",
                "Service Interruption");
    }

    public void SendProgress()
    {
        _pageProgressService.Go(25);
    }
    public void SendHideProgress()
    {
        _pageProgressService.Go(-1);
    }
}
